# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=thumbcacheviewer
_pkgname=thumbcache_viewer
pkgver=1.0.3.7
pkgrel=1
groups=('blackarch' 'blackarch-forensic' 'blackarch-windows')
pkgdesc='Extract Windows thumbcache database files.'
arch=('any')
url='https://github.com/thumbcacheviewer/thumbcacheviewer'
license=('custom:unknown')
depends=('wine' 'wine_gecko' 'wine-mono')
source=("https://github.com/$pkgname/$pkgname/releases/download/v$pkgver/${_pkgname}_64.zip")
sha512sums=('3519513c4191041a2c883cabbccb79e7be2b711fcab485afa9ff49eb1519e587cf883bca24e0fbd1761f45199bcf8c993d383aac97ccd848feb61bc7a323cf5d')

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/windows/$pkgname"

  cp --no-preserve=ownership "$_pkgname.exe" \
    "$pkgdir/usr/share/windows/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/windows/$pkgname
exec wine "$_pkgname.exe" "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

